import Vue from 'vue'
import Router from 'vue-router'
const originalReplace = Router.prototype.replace
Router.prototype.replace = function replace (location) {
  return originalReplace.call(this, location).catch(err => err)
}
const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Index',
      component: require('@/pages/Index').default
    },
    {
      path: '*',
      redirect: '/'
    },
    {
      path: '/user',
      name: 'user',
      component: require('@/pages/User').default
    },
    {
      path: '/DeviceList',
      name: 'DeviceList',
      component: require('@/pages/DeviceList').default
    },
    {
      path: '/DeviceScan',
      name: 'DeviceScan',
      component: require('@/pages/DeviceScan').default
    },
    {
      path: '/Setting',
      name: 'Setting',
      component: require('@/pages/Setting').default
    },
    {
      path: '/PullPicture',
      name: 'PullPicture',
      component: require('@/pages/PullPicture').default
    },
    {
      path: '/ApplicationList',
      name: 'ApplicationList',
      component: require('@/pages/ApplicationList').default
    }
  ]
})
